{literal}
  <script type="text/javascript">
<!--
function confirmDelete(articleId) {
if (confirm("This will delete this item. Continue?"))
{/literal}
document.location = "{$pagename}&action=delete&patrol={$patrolname}&id=" + articleId;
{literal}
}

function show(id)
{
	var item = null;
	if (document.getElementById)
	{
		item = document.getElementById(id);
	}
	else if (document.all)
	{
		item = document.all[id];
	}
	else if (document.layers)
	{
		item = document.layers[id];
	}

	if (item && item.style)
	{
        if (item.style.display == "none")
		{
			item.style.display = "";
		}
	}
	else if (item)
	{
		item.visibility = "show";
	}
}

function show_hide(id)
{
	var item = null;
    hideall();
	if (document.getElementById)
	{
		item = document.getElementById(id);
	}
	else if (document.all)
	{
		item = document.all[id];
	}
	else if (document.layers)
	{
		item = document.layers[id];
	}

	if (item && item.style)
	{
        if (item.style.display == "none")
		{
			item.style.display = "";
		}
	}
	else if (item)
	{
		item.visibility = "show";
	}
}

function hide(id)
{
	var item = null;
    var sub = null;
	if (document.getElementById)
	{
		item = document.getElementById(id);
	}
	else if (document.all)
	{
		item = document.all[id];
	}
	else if (document.layers)
	{
		item = document.layers[id];
	}

	if (item && item.style)
	{
       item.style.display = "none";
	}
	else if (item)
	{
		item.visibility = "hide";
	}
}

function hideall()
{
  	var item = null;
    var i = 0;
    
    var id = ['left', 'right', 'top'];
    for(i=0;i<3;i++)
    {
        if (document.getElementById)
        {
            item = document.getElementById(id[i]);
        }
        else if (document.all)
        {
            item = document.all[id[i]];
        }
        else if (document.layers)
        {
            item = document.layers[id[i]];
        }
        
        if (item && item.style)
        {
            item.style.display = "none";
        } 
    }
}

function itemss()
{
    var urlenabled = {/literal}{if $numpages > 0}true{else}false{/if}{literal};
    if (document.form2.items.selectedIndex==0 && urlenabled == true)
    {
        show_hide('urldiv');
    }
    else
    {
       hide('urldiv');
    }
}
//-->
  </script>
  {/literal}
{if $action == "view" || $action == ""}
{if $numside > 0 || $numtop > 0 || $numbottom > 0}
<h2>Links on {$patrolname} menu</h2>
<div align="left"><input type="button" class="button" value="Add new link" onclick="window.location='{$pagename}&amp;action=new&amp;patrol={$patrolname}'" />&nbsp;<input type="button" class="button" value="Content Manager" onclick="window.location='admin.php?page=patrolcontent&amp;patrol={$patrolname}'" /></div>
	<table width="100%" border="0" cellpadding="4" cellspacing="1" class="table">
  {if $numside > 0}
  <tr>
    <th class="bighead" colspan="4">Side Menu</th>
 </tr>
  <tr>
    <th width="15%" scope="col" class="smallhead">Action</th>
    <th scope="col" class="smallhead">Name</th>
    <th width="41%" scope="col" class="smallhead">Action of item</th>
    <th width="10%" scope="col" class="smallhead">Position</th>
  </tr>
  {section name=cats loop=$numside}
  <tr>
    <td class="text"><a href="{$pagename}&amp;action=edit&amp;id={$side[cats].id}&amp;patrol={$patrolname}"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$side[cats].name}" title="Edit {$side[cats].name}" /></a> - <a href="javascript:confirmDelete({$side[cats].id})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$side[cats].name}" title="Delete {$side[cats].name}" /></a></td>
    <td class="text">{$side[cats].name}</td>
    <td class="text">{$side[cats].action}</td>
    <td class="text">{if $smarty.section.cats.iteration != 1}<a href="{$pagename}&amp;action=moveup&amp;id={$side[cats].id}&amp;patrol={$patrolname}"><img src="{$tempdir}admin/images/up.gif" border="0" alt="Move Up" title="Move Up" /></a>&nbsp;{/if}{if $smarty.section.cats.iteration != $numside}<a href="{$pagename}&amp;action=movedown&amp;id={$side[cats].id}&amp;patrol={$patrolname}"><img src="{$tempdir}admin/images/down.gif" border="0" alt="Move Down" title="Move Down" /></a>{/if}</td>
  </tr>
  {/section}
  {/if}
  {if $numtop > 0}
  <tr>
    <th class="bighead" colspan="4">Top Menu</th>
 </tr>
  <tr>
    <th width="15%" scope="col" class="smallhead">Action</th>
    <th scope="col" class="smallhead">Name</th>
    <th width="41%" scope="col" class="smallhead">Action of item</th>
    <th width="10%" scope="col" class="smallhead">Position</th>
  </tr>
  {section name=cats loop=$numtop}
  <tr>
    <td class="text"><a href="{$pagename}&amp;action=edit&amp;id={$top[cats].id}&amp;patrol={$patrolname}"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$top[cats].name}" title="Edit {$top[cats].name}" /></a> - <a href="javascript:confirmDelete({$top[cats].id})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$top[cats].name}" title="Delete {$top[cats].name}" /></a></td>
    <td class="text">{$top[cats].name}</td>
    <td class="text">{$top[cats].action}</td>
    <td class="text">{if $smarty.section.cats.iteration != 1}<a href="{$pagename}&amp;action=moveup&amp;id={$top[cats].id}&amp;patrol={$patrolname}"><img src="{$tempdir}admin/images/up.gif" border="0" alt="Move Up" title="Move Up" /></a>&nbsp;{/if}{if $smarty.section.cats.iteration != $numtop}<a href="{$pagename}&amp;action=movedown&amp;id={$top[cats].id}&amp;patrol={$patrolname}"><img src="{$tempdir}admin/images/down.gif" border="0" alt="Move Down" title="Move Down" /></a>{/if}</td>
  </tr>
  {/section}
  {/if}
  {if $numbottom > 0}
  <tr>
    <th class="bighead" colspan="4">Bottom Menu</th>
 </tr>
  <tr>
    <th width="15%" scope="col" class="smallhead">Action</th>
    <th scope="col" class="smallhead">Name</th>
    <th width="41%" scope="col" class="smallhead">Action of item</th>
    <th width="10%" scope="col" class="smallhead">Position</th>
  </tr>
  {section name=cats loop=$numbottom}
  <tr>
    <td class="text"><a href="{$pagename}&amp;action=edit&amp;id={$bottom[cats].id}&amp;patrol={$patrolname}"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$bottom[cats].name}" title="Edit {$bottom[cats].name}" /></a> - <a href="javascript:confirmDelete({$bottom[cats].id})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$bottom[cats].name}" title="Delete {$bottom[cats].name}" /></a></td>
    <td class="text">{$bottom[cats].name}</td>
    <td class="text">{$bottom[cats].action}</td>
    <td class="text">{if $smarty.section.cats.iteration != 1}<a href="{$pagename}&amp;action=moveup&amp;id={$bottom[cats].id}&amp;patrol={$patrolname}"><img src="{$tempdir}admin/images/up.gif" border="0" alt="Move Up" title="Move Up" /></a>&nbsp;{/if}{if $smarty.section.cats.iteration != $numbottom}<a href="{$pagename}&amp;action=movedown&amp;id={$bottom[cats].id}&amp;patrol={$patrolname}"><img src="{$tempdir}admin/images/down.gif" border="0" alt="Move Down" title="Move Down" /></a>{/if}</td>
  </tr>
  {/section}
  {/if}
</table>
{else}
<div align="center">There are no links on the menu</div>
{/if}
<div align="left"><input type="button" class="button" value="Add new link" onclick="window.location='{$pagename}&amp;action=new&amp;patrol={$patrolname}'" />&nbsp;<input type="button" class="button" value="Content Manager" onclick="window.location='admin.php?page=patrolcontent&amp;patrol={$patrolname}'" />&nbsp;<input type="button" class="button" value="Group Sites" onclick="window.location='admin.php?page=patrol'" /></div>
{elseif $action == "new" || $action == "edit"}
<form name="form2" method="post" action="{$editFormAction}">
  <div align="left">Name of menu item:
    <input name="name" type="text" id="name" value="{$item.name}" class="inputbox" />
    <br />
    <br />
    Content to link to:
    <select name="items" id="items" class="inputbox" onchange="itemss();">
      <option value="url" {if $item.item == '' || $item.item == 'url'}selected{/if}>URL</option>
      {section name=function loop=$numfunc}
	  	<option value="{$func[function].name}" {if $item.item == $func[function].name}selected{/if}>Dynamic Content: {$func[function].name}</option>
	  {/section}
      {section name=pages loop=$numpages}
        <option value="{$page[pages].name}" {if $item.item == $page[pages].name}selected{/if}>Static Content: {$page[pages].name}</option> 
     {/section}	  
    </select></div>
<div id="urldiv" style="display: {if $item.url == '' && $action == 'edit'}none;{else}'';{/if}">
    URL:
    <input name="url" type="text" id="url" value="{$item.url}" class="inputbox" size="50" /></div>
<div align="left">
<div align="left">
Location:<label>
    <input name="location" type="radio" value="side" {if $item.side == 'side' ||  $item.side == ''}checked{/if} />
Side</label>
    <label>
    <input type="radio" name="location" value="top" {if $item.side == 'top'}checked{/if}/>
Top</label>    
    <label>
    <input type="radio" name="location" value="bottom" {if $item.side == 'bottom'}checked{/if} />
Bottom</label>    
</div>
<div align="left">
    <input type="submit" name="Submit" value="Submit" class="button" />
    <input type="button" name="Cancel" value="Cancel" onclick="history.go(-1);" class="button" />
   </div>
</form>
{/if}
